#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

e()
{
	return ( 2.71828 );
}

pi()
{
	return ( 3.14159 );
}

radToDegrees( rad )
{
	return ( ( 180 * rad ) / 3.14159 );
}

degreesToRad( degrees )
{
	return ( ( degrees * 3.14159 ) / 180 );
}

power( number, exp )
{
	numberused = number;
	for ( i = 1; i < exp; i++ )
		numberused *= number;
	return numberused;
}

cotan( angle )
{
	return ( cos( angle ) / sin( angle ) );
}

sec( angle )
{
	return ( 1 / cos( angle ) );
}

cosec( angle )
{	
	return ( 1 / sin( angle ) );
}

versin( angle )
{
	return ( 1 - cos( angle ) );
}

ValueIsBeetween(value,max,min) 
{
	if(value > min && value < max)
		return true;
	return false;
}

bisection( angle1, angle2 )
{
	return ( ( angle1 + angle2 ) / 2 );
}

pointsAreInLine( point1, point2, point3 )
{
	if( ( ( point2[0] - point1[0] ) / ( point3[0] - point1[0] ) ) == ( ( point2[1] - point1[1] ) / ( point3[1] - point1[1] ) ) && ( ( point2[0] - point1[0] ) / ( point3[0] - point1[0] ) ) == ( ( point2[2] - point1[2] ) / ( point3[2] - point1[2] ) ) )	
		return true;
	return false;
}

areParallel( vector1, vector2 )
{
	if( ( vector1[0] / vector2[0] ) == ( vector1[1] / vector2[1] ) && ( vector1[0] / vector2[0] ) == ( vector1[2] / vector2[2] ) )
		return true;
	return false;
}

vectorScale( vector, scale ) 
{
	return ( vector[0] * scale, vector[1] * scale, vector[2] * scale );
}

vectorDivision( vector, number ) 
{
	return ( vector[0] / number, vector[1] / number, vector[2] / number );
}


vectorsAngle( vector1, vector2 ) 
{
	return acos( vectorDot( vector1, vector2 ) / ( LenghtSquared( vector1 ) * LenghtSquared( vector2 ) ) );
}

vectorTo2D( vector ) 
{
	return ( vector[0], vector[1], 0 );
}

isInFOV( position ) 
{
	dot = VectorDot( anglesToForward( self.angles ), VectorNormalize( position - self.origin ) );
	return ( dot >= 0.766 );
}